﻿using System;
using System.Collections.Generic;
using Microsoft.Practices.PageFlow;

namespace PageFlow.Util
{
    public interface IPageFlowUtil
    {
         void Start(IPageFlow pageFlowToStart, IPageFlow pageFlowToReturnTo);
         void Start(IPageFlow pageFlow);
         void Start(IPageFlow pageFlow, bool clearUserData);

         void Navigate(IPageFlow pageFlow, string transition);
         void Navigate(IPageFlow pageFlow, string transition, string[] keys);

         void Complete(IPageFlow pageFlow);

         void Abort(IPageFlow pageFlow);

         void EnsureStartPage(IPageFlow pageFlow);

         void EnsureCurrentPage(IPageFlow pageFlow, string page);

         bool IsCurrentPage(IPageFlow pageFlow, string page);

         bool IsRunning(IPageFlow pageFlow);
         bool IsRunning(IPageFlow pageFlow, bool start);

         bool IsExternalWorkFlow(IPageFlow currentPageFlow);

         void RedirectToExternalPageFlow(IPageFlow fromPageflow, IPageFlow toPageflow, string state);
         void RedirectToExternalPageFlow(IPageFlow fromPageflow, IPageFlow toPageflow, string state, Dictionary<string, object> externalUserData);

         void RedirectToExternalPageFlow(IPageFlow fromPageflow, IPageFlow toPageflow, Dictionary<string, object> externalUserData);
         void RedirectToExternalPageFlow(IPageFlow fromPageflow, IPageFlow toPageflow);

         void RedirectToExternalAccess(IPageFlow pageFlow);
         void RedirectToExternalAccess(IPageFlow pageFlow, Dictionary<string, object> externalUserData);


         void RemoveUserDataKey(IPageFlow pageFlow, string key);

         T GetUserData<T>(IPageFlow pageFlow, string key, bool abortOnMissing);
         T GetUserData<T>(IPageFlow pageFlow, string key);

         void ClearUserData(IPageFlow pageFlow);
         void ClearUserData(IPageFlow pageFlow, bool keepExternalWorkflowReference);

         void EnsureDataIntegrity(IPageFlow pageFlow, List<string> dataNeeded, string onProblemPage);
         void EnsureDataIntegrity(IPageFlow pageFlow, IDictionary<string, Type> dataNeeded);
         void EnsureDataIntegrity(IPageFlow pageFlow, IDictionary<string, Type> dataNeeded, string onProblemPage);
    }
}
